@extends('admin::layouts.master')
@section('title')
    修改免责声明
@endsection
@section('tab')
    <div class="layui-fluid">

    <div class="layui-card">
        <div class="layui-card-header ">
            免责声明
        </div>
    </div>
    </div>

        <div class="layui-fluid">
        <div class="layui-row">
            <form class="layui-form" lay-filter="form_edit">


                <div class="layui-form-item layui-form-text">
                    <label for="content" class="layui-form-label">
                        <span class="x-red">*</span>免责声明
                    </label>

                    <div class="layui-input-inline">
                        <textarea  cols="100" id="content" name="content" placeholder="请输入内容" required="" lay-verify="content" autocomplete="off" class="layui-textarea"></textarea>
                    </div>
               {{--     <div class="layui-form-mid layui-word-aux">
                        <span class="x-red">*</span>免责声明
                    </div>--}}
                </div>

                <div class="layui-form-item">
                    <label for="L_repass" class="layui-form-label"></label>
                    <button class="layui-btn" lay-filter="edit" lay-submit="">修改</button>
                    <input type="hidden" id="L_id" name="id">
                </div>
            </form>
        </div>
    </div>
@endsection

@section('tab_js')
    <script>
        layui.use(['form', 'layer','layedit','jquery'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                    layer = layui.layer,
                    layedit = layui.layedit;

                //创建一个编辑器
                var editIndex = layedit.build('LAY_demo_editor');

                //自定义验证规则
                form.verify({
                    content: function(value) {
                        if (value.length < 1) {
                            return '至少1个字符';
                        }
                        layedit.sync(editIndex);
                    },
                });


                //监听提交
                form.on('submit(edit)',
                    function(data) {
                        var $_url = '{{route('admin_disclaimer_update')}}';
                        var $_data = data.field;
                        $.ajax({
                            url:$_url,
                            type:'put',
                            data:$_data,
                            dataType : "json",
                            success:function(result){
                                if(result.state === 0){
                                    layer.msg(
                                        "修改成功",
                                        {icon: 6},
                                        function() {
                                            location.reload();
                                        });
                                }else{
                                    layer.msg(result.msg, {time:2000,icon: 5});
                                }

                            }});
                        return false;

                    });

                //表单初始赋值
                form.val('form_edit', {
                    "id": '{{$arr_data['id']}}',
                    "content": '{{$arr_data['content']}}',
                })

            });
    </script>
@endsection




